webpackJsonp([61],{

/***/ "Wtf3":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ }),

/***/ "ra66":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/regenerator/index.js
var regenerator = __webpack_require__("lC5x");
var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__("J0Oq");
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);

// EXTERNAL MODULE: ./node_modules/_babel-runtime@6.26.0@babel-runtime/helpers/extends.js
var helpers_extends = __webpack_require__("4YfN");
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);

// EXTERNAL MODULE: ./src/store/index.js
var store = __webpack_require__("IcnI");

// EXTERNAL MODULE: ./src/common/api/commonApi.js
var commonApi = __webpack_require__("+/+p");

// EXTERNAL MODULE: ./src/common/anjian/emergency/router.js
var router = __webpack_require__("ZXm2");

// CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=script&index=0!./src/common/anjian/emergency/instructionRecords.vue



//
//
//
//
//
//
//
//
//
//
//
//
//
//

 // 依赖各个安监项目下独立的 store



/* harmony default export */ var instructionRecords = ({
  data: function data() {
    var _this = this;

    return {
      emergencyObj: {},
      actions: [],
      rightData: [{
        font: 'yt-icon yt-icon-add',
        click: function click() {
          _this.$router.$push({
            path: router["g" /* InstructionRecordAdd */].path,
            query: extends_default()({}, _this.$route.query)
          });
        }
      }]
    };
  },
  created: function created() {
    var _this2 = this;

    store["a" /* BUS */].$on(store["b" /* EVENTS */].emergencyCommandActionAdd, function () {
      var _ref = asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee(form) {
        return regenerator_default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _this2.actions.push(extends_default()({}, form));
                _this2.updateActions();

              case 2:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, _this2);
      }));

      return function (_x) {
        return _ref.apply(this, arguments);
      };
    }());
  },
  activated: function activated() {
    if (this.$router.$isBack) return;
    this.queryActions();
  },

  methods: {
    queryActions: function queryActions() {
      var _this3 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee2() {
        var actionsBefor, arr;
        return regenerator_default.a.wrap(function _callee2$(_context2) {
          while (1) {
            switch (_context2.prev = _context2.next) {
              case 0:
                _context2.next = 2;
                return commonApi["a" /* commonApi */].search('yj_instruction_record', {
                  equalTo: {
                    index: _this3.$route.query.index,
                    programmeId: _this3.$route.query.programmeId,
                    accidentId: _this3.$route.query.accidentId
                  }
                });

              case 2:
                actionsBefor = _context2.sent;
                arr = [];

                actionsBefor.map(function (v) {
                  v.list.map(function (h) {
                    arr.push(h);
                  });
                });
                _this3.actions = arr;

              case 6:
              case 'end':
                return _context2.stop();
            }
          }
        }, _callee2, _this3);
      }))();
    },
    remove: function remove(index, loaded) {
      var _this4 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee3() {
        return regenerator_default.a.wrap(function _callee3$(_context3) {
          while (1) {
            switch (_context3.prev = _context3.next) {
              case 0:
                _this4.actions.splice(index, 1);
                _context3.next = 3;
                return _this4.updateActions();

              case 3:
                loaded;

              case 4:
              case 'end':
                return _context3.stop();
            }
          }
        }, _callee3, _this4);
      }))();
    },
    updateActions: function updateActions() {
      var _this5 = this;

      return asyncToGenerator_default()( /*#__PURE__*/regenerator_default.a.mark(function _callee4() {
        var obj;
        return regenerator_default.a.wrap(function _callee4$(_context4) {
          while (1) {
            switch (_context4.prev = _context4.next) {
              case 0:
                obj = {
                  accidentId: _this5.$route.query.accidentId,
                  programmeId: _this5.$route.query.programmeId,
                  index: parseInt(_this5.$route.query.index),
                  list: _this5.actions
                };

                commonApi["a" /* commonApi */].search('yj_instruction_record', {
                  equalTo: {
                    index: parseInt(_this5.$route.query.index),
                    programmeId: _this5.$route.query.programmeId,
                    accidentId: _this5.$route.query.accidentId
                  }
                }).then(function (res) {
                  res = res.map(function (v) {
                    return commonApi["a" /* commonApi */].createInstance('yj_instruction_record', v.id);
                  });
                  commonApi["a" /* commonApi */].destroyAll(res).then(function (res) {
                    commonApi["a" /* commonApi */].save('yj_instruction_record', obj).then(function (res) {
                      _this5.$Toast('操作成功!', 'success');
                    });
                  });
                });

              case 2:
              case 'end':
                return _context4.stop();
            }
          }
        }, _callee4, _this5);
      }))();
    }
  }
});
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.7.3@vue-loader/lib/template-compiler?{"id":"data-v-0ec4006b","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/_vue-loader@13.7.3@vue-loader/lib/selector.js?type=template&index=0!./src/common/anjian/emergency/instructionRecords.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('yt-page',{attrs:{"title":"指令记录","scroll":"","rightData":_vm.rightData}},_vm._l((_vm.actions),function(item,index){return _c('yt-card',{key:index,staticClass:"no-padding",attrs:{"tag":false,"title":_vm._f("formatTime")(item.Time)}},[_c('div',{attrs:{"slot":"more"},slot:"more"},[_c('yt-btn',{attrs:{"theme":"red","size":"mini","loading":function (loaded) { return _vm.remove(item.index, loaded); }}},[_vm._v("删除")])],1),_vm._v(" "),_c('yt-textarea',{attrs:{"title":"执行步骤","type":"row","disabled":""},model:{value:(item.context),callback:function ($$v) {_vm.$set(item, "context", $$v)},expression:"item.context"}}),_vm._v(" "),_vm._l((item.file),function(f,i){return _c('yt-cell-open-file',{key:i,staticClass:"file-item",attrs:{"title":f.name,"url":f.url}},[_vm._v("\n      "+_vm._s(f.name)+"\n    ")])})],2)}),1)}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var emergency_instructionRecords = (esExports);
// CONCATENATED MODULE: ./src/common/anjian/emergency/instructionRecords.vue
function injectStyle (ssrContext) {
  __webpack_require__("Wtf3")
}
var normalizeComponent = __webpack_require__("C7Lr")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-0ec4006b"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  instructionRecords,
  emergency_instructionRecords,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var anjian_emergency_instructionRecords = __webpack_exports__["default"] = (Component.exports);


/***/ })

});